import { storeproduct } from "@/types/base";

export class storeorder {
  id?= 0;
  orderId = '';
  uid = 0;
  realName = '';
  userPhone = '';
  userAddress = '';
  totalNum = 0;
  totalPrice = '';
  payPrice = '';
  payPostage = '';
  couponPrice = '';
  deductionPrice = '';
  payType = '';
  createTime = '';
  status = 0;
  refundStatus = 0;
  deliveryName = '';
  deliveryType = '';
  deliveryId = '';
  mark = '';
  isDel = false;
  refundPrice = '';
  useIntegral = 0;
  backIntegral = 0;
  verifyCode = '';
  shippingType = 0;
  payTypeStr = '';
  nikeName = '';
  phone = '';
  orderInfo: IOrderInfo[] = [];
  proTotalPrice = '';
  refundReasonWapImg = []
  refundReasonWap = ''
  refundReasonWapExplain = ''
  remark = ''
  reason = ''
  refundReasonTime = ''
  amount = 0
  statusStr = { value: '', key: '' }
  productList = [{ info: { image: '', productName: '', sku: '', price: '', payNum: '' } }]
  constructor(data?: storeorder) {
    data && this.setProps(data);
  }

  setProps(data: storeorder) {
    (Object.keys(this) as Array<keyof Istoreorder>).forEach((key) => {
      // @ts-ignore
      this[key] = data[key]
    })
  }
}

export type Istoreorder = Omit<storeorder, 'setProps'>

export interface IOrderInfo {
  id: number;
  orderId: number;
  productId: number;
  info: any;
  unique: string;
}

export class orderType {
  all = 0
  unPaid = 0
  notShipped = 0
  spike = 0
  bargain = 0
  complete = 0
  toBeWrittenOff = 0
  refunding = 0
  refunded = 0
  deleted = 0
  constructor(data?: orderType) {
    data && this.setProps(data);
  }

  setProps(data: orderType) {
    (Object.keys(this) as Array<keyof IorderType>).forEach((key) => {
      // @ts-ignore
      this[key] = data[key]
    })
  }
}
export type IorderType = Omit<orderType, 'setProps'>

export class ISendOrder {
  type = ''
  expressRecordType = ''
  expressCode = ''
  expressNumber = ''
  expressTempId = ''
  toName = ''
  toTel = ''
  toAddr = ''
  expressId = ''
  deliveryName = ''
  deliveryTel = ''
  orderNo = ''
  constructor(data?: ISendOrder) {
    data && this.setProps(data);
  }

  setProps(data: ISendOrder) {
    (Object.keys(this) as Array<keyof IISendOrder>).forEach((key) => {
      // @ts-ignore
      this[key] = data[key]
    })
  }
}
export type IISendOrder = Omit<ISendOrder, 'setProps'>



export class Temp {
  temp_id = ''
  pic = ''
  title = ''
  constructor(data?: Temp) {
    data && this.setProps(data);
  }

  setProps(data: Temp) {
    (Object.keys(this) as Array<keyof ITemp>).forEach((key) => {
      // @ts-ignore
      this[key] = data[key]
    })
  }
}
export type ITemp = Omit<Temp, 'setProps'>